import openpyxl
from openpyxl.worksheet.worksheet import Worksheet


def read_excel_dict(fspath, sheet_name):
    """得到每一行数据是字典。"""
    wb = openpyxl.load_workbook(fspath)
    sheet: Worksheet = wb[sheet_name]
    rows = list(sheet.values)
    title = rows[0]  # ['id', 'title', 'url', ...]
    rows = rows[1:]
    new_rows = [dict(zip(title, row)) for row in rows]
    return new_rows
